﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using ThaireInvestmentWeb.WcfSerivce;

namespace ThaireInvestmentWeb.Models
{
    public class AmortizeScheduleModel
    {

        AmortizeScheduleScreenData ScrData;
       


        public static AmortizeScheduleModel Build(AmortizeScheduleScreenData data)
        {
            AmortizeScheduleModel model = new AmortizeScheduleModel();
            model.ScrData = data;
            model.ScheduleList = new List<FixincomesecuritiesAmortizeSchedule>();
            model.ScheduleList.AddRange(model.ScrData.ScheduleList);

            return model;
        }

        public int HeaderID
        {
            set;
            get;
        }
        public AddFixedIncomePurchaseModel HeaderDto
        {
            get
            {
                return new AddFixedIncomePurchaseModel(ScrData.FixIncomeSecuritiesDTO);
            }
        }

        public List<FixincomesecuritiesAmortizeSchedule> ScheduleList
        {
            set;
            get;
        }
        public int? DeleteID { get; set; }
        public string BtnSubmit { get; set; }

        [Required(ErrorMessage = "โปรดระบุ")]
        public DateTime? PaymentDate { get; set; }

        [Required(ErrorMessage = "โปรดระบุ")]
        [Range(0, (double)decimal.MaxValue, ErrorMessage = "ข้อมูลต้อง >= 0")]
        public decimal? AmortizingPayment { get; set; }
    }

}